<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>记录 emergency 日志</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="seaslog.destruct.html">« SeasLog::__destruct</a></li>
      <li style="float: right;"><a href="seaslog.error.html">SeasLog::error »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.seaslog.html">SeasLog</a></li>
    <li>记录 emergency 日志</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="seaslog.emergency" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SeasLog::emergency</h1>
  <p class="verinfo">(PECL seaslog &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">SeasLog::emergency</span> &mdash; <span class="dc-title">记录 emergency 日志</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-seaslog.emergency-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>SeasLog::emergency</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$message</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$content</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$logger</code><span class="initializer"> = ?</span></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
    记录 emergency 日志
    <blockquote class="note"><p><strong class="note">注意</strong>: 
      <p class="para">
        &quot;EMERGENCY&quot; - 系统不可用。
      </p>
    </p></blockquote>
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-seaslog.emergency-parameters">
  <h3 class="title">参数</h3>
  <dl>
    
    <dt>
<code class="parameter">message</code></dt>

    <dd>

     <p class="para">
      日志的消息
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">content</code></dt>

    <dd>

     <p class="para">
      &quot;消息&quot;包含占位符，实现用 content 数组中的值替换这些占位符。
       例如&#039;消息&#039;是 `log info from {NAME}`, &#039;内容&#039;是 `array(&#039;NAME&#039; =&gt; neeke)`，
       日志信息是 `log info from neeke`
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">logger</code></dt>

    <dd>

     <p class="para">
      当函数调用 SeasLog::setLogger() 时，就像临时 logger 一样，在第三个参数中使用这个&quot;logger&quot;。
      如果 `logger` 为 NULL 或 &quot;&quot;，那么 SeasLog 将使用由<span class="methodname"><a href="seaslog.setlogger.html" class="methodname">SeasLog::setLogger()</a></span>设置的最新 Logger。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-seaslog.emergency-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   记录日志信息成功返回 TRUE，失败返回 FALSE。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-seaslog.emergency-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-3523">
   <p><strong>示例 #1 <span class="function"><strong>SeasLog::emergency()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">SeasLog</span><span style="color: #007700">::</span><span style="color: #0000BB">emergency</span><span style="color: #007700">(</span><span style="color: #DD0000">'log&nbsp;message'</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//with&nbsp;content<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">SeasLog</span><span style="color: #007700">::</span><span style="color: #0000BB">emergency</span><span style="color: #007700">(</span><span style="color: #DD0000">'log&nbsp;message&nbsp;from&nbsp;{NAME}'</span><span style="color: #007700">,array(</span><span style="color: #DD0000">'NAME'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'neeke'</span><span style="color: #007700">)));<br /><br /></span><span style="color: #FF8000">//with&nbsp;tmp&nbsp;logger<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">SeasLog</span><span style="color: #007700">::</span><span style="color: #0000BB">emergency</span><span style="color: #007700">(</span><span style="color: #DD0000">'log&nbsp;message&nbsp;from&nbsp;{NAME}'</span><span style="color: #007700">,array(</span><span style="color: #DD0000">'NAME'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'neeke'</span><span style="color: #007700">),</span><span style="color: #DD0000">'tmp_logger'</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">SeasLog</span><span style="color: #007700">::</span><span style="color: #0000BB">getBuffer</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
bool(true)
bool(true)
bool(true)
array(2) {
  [&quot;/var/log/www/default/20180707.log&quot;]=&gt;
  array(2) {
    [0]=&gt;
    string(81) &quot;2018-07-07 11:45:49 | EMERGENCY | 73263 | 5b40376d1067c | 1530935149.68 | log message
&quot;
    [1]=&gt;
    string(92) &quot;2018-07-07 11:45:49 | EMERGENCY | 73263 | 5b40376d1067c | 1530935149.68 | log message from neeke
&quot;
  }
  [&quot;/var/log/www/tmp_logger/20180707.log&quot;]=&gt;
  array(1) {
    [0]=&gt;
    string(92) &quot;2018-07-07 11:45:49 | EMERGENCY | 73263 | 5b40376d1067c | 1530935149.68 | log message from neeke
&quot;
  }
}
</pre></div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-seaslog.emergency-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><a href="seaslog.configuration.html#ini.seaslog.default-template" class="link">seaslog.default_template</a></li>
   <li class="member"><span class="methodname"><a href="seaslog.debug.html" class="methodname" rel="rdfs-seeAlso">SeasLog::debug()</a> - 记录 debug 日志</span></li>
   <li class="member"><span class="methodname"><a href="seaslog.info.html" class="methodname" rel="rdfs-seeAlso">SeasLog::info()</a> - Record info log information</span></li>
   <li class="member"><span class="methodname"><a href="seaslog.notice.html" class="methodname" rel="rdfs-seeAlso">SeasLog::notice()</a> - 记录 notice 日志</span></li>
   <li class="member"><span class="methodname"><a href="seaslog.warning.html" class="methodname" rel="rdfs-seeAlso">SeasLog::warning()</a> - Record warning log information</span></li>
   <li class="member"><span class="methodname"><a href="seaslog.error.html" class="methodname" rel="rdfs-seeAlso">SeasLog::error()</a> - 记录 error 日志</span></li>
   <li class="member"><span class="methodname"><a href="seaslog.critical.html" class="methodname" rel="rdfs-seeAlso">SeasLog::critical()</a> - 记录 critical 日志</span></li>
   <li class="member"><span class="methodname"><a href="seaslog.alert.html" class="methodname" rel="rdfs-seeAlso">SeasLog::alert()</a> - 记录 alert 日志</span></li>
   <li class="member"><span class="methodname"><a href="seaslog.log.html" class="methodname" rel="rdfs-seeAlso">SeasLog::log()</a> - 公共的日志记录函数</span></li>
  </ul>
 </div>



</div></div></div></body></html>